package com.example.demo.concurrent;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * <pre>
 *  描述:
 * </pre>
 *
 * @author godelgnis(wujiaer)
 * @version 1.0.0
 * @date 2022/2/15 17:24
 */
@Slf4j
public class CompletableFutureTest {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //CompletableFuture<Void> wake_up = CompletableFuture.runAsync(() -> {
        //    try {
        //        Thread.sleep(2000);
        //        log.info("wake up");
        //    } catch (InterruptedException e) {
        //        e.printStackTrace();
        //    }
        //});
        //CompletableFuture.completedFuture("message").thenApplyAsync(String::toUpperCase).thenAcceptAsync(log::info);
        //log.info("do main");
        //Thread.sleep(4000);
        //log.info("done");

        Item item = new Item();

        System.out.println(item);

        JSONObject jsonObject = JSONUtil.parseObj(item);
    }



}
@Data
class Item{
    List<String> doubles = new LinkedList<>();

    Map<String, String> map = new HashMap<String, String>(){{
        put("k1", "v1");
        put("k2", "v2");
        put("k3", null);
        put("k4", "v1");
    }};

    Item() {
        doubles.add("2.2");
        doubles.add(null);
        doubles.add("2.2");
        doubles.add("2.2");
        doubles.add("2.2");
        doubles.add(null);
        doubles.add(null);
        doubles.add("2.2");
    }
}